<?php
Class BoatView{
	
		private $m_getMemberId = "memberId";
		private $m_getBoatType = "boatType";
		private $m_getBoatLength = "boatLength";
		private $m_getRegisterBoatButton = "registerBoatButton";
		private $m_getBoatId = "boatId";
		private $m_getDeleteBoatButton = "deleteBoatButton";
		private $m_getBoatUpdateButton = "boatUpdateButton";

		//FORMS:
		
		public function DoAddBoatInfoView() {
			return "
					<h2>Lägg till båtinfo</h2>
					<form method='POST'>
					<fieldset>
					<p><label>Medlemsnummer:</label> <input type='text' name='$this->m_getMemberId' id='memberid' /></p>
					<p><label>Båttyp:</label> <input type='text' name='$this->m_getBoatType' id='boatType' /></p>
					<p><label>Längd:</label> <input type='text' name='$this->m_getBoatLength' id='boatLength' /></p> 
					<p><input type='submit' value='Registrera' name='$this->m_getRegisterBoatButton' id='RegisterBoatButton'/></p>
					</fieldset>
					</form>
					";
		}
		
		public function DoDeleteBoatView(){
				return "
				<h2>Ta bort båt</h2>
				<form method='POST'>
					<fieldset>
						<legend>Skriv in id:t</legend>
							<p><label>Båtnummer:</label> <input type='text' name='$this->m_getBoatId' id='memberId' /></p>
							<p><input type='submit' value='Ta bort båt' name='$this->m_getDeleteBoatButton' id='delete' />
					</fieldset>
				</form>
			";
		}
				
		public function DoEditBoatView(){
			return "
			<h2>Uppdatera båt</h2>
			<form method='POST'>
				<fieldset>
					<legend></legend>
						<p><label>Båtnummer:</label> <input type='text' name='$this->m_getBoatId' id='boatId' /></p>
						<p><label>Båttyp:</label> <input type='text' name='$this->m_getBoatType' id='boatType' /></p>
						<p><label>Längd:</label> <input type='text' name='$this->m_getBoatLength' id='boatLength' /></p>
						<p><input type='submit' value='Ändra uppgifter' name='$this->m_getBoatUpdateButton' id='boatRegister' />
				</fieldset>
			</form>	
			";
		}
		
		//POSTS:
		
		public function GetMemberId() {
			if (isset($_POST[$this->m_getMemberId]) != null) {
					return $_POST[$this->m_getMemberId];
			}
			return null;
		}
		
		public function GetBoatId(){
			if (isset($_POST[$this->m_getBoatId]) != null ) {
				return ($_POST[$this->m_getBoatId]);
			}
			return null;
		}
		
		public function GetBoatType() {
			if (isset($_POST[$this->m_getBoatType]) != null) {
					return $_POST[$this->m_getBoatType];
			}
			return null;
		}
		
		public function GetBoatLength() {
			if (isset($_POST[$this->m_getBoatLength]) != null) {
					return $_POST[$this->m_getBoatLength];
			}
			return null;
		}
		
		//BUTTONS:
		
		public function TriedToAddBoatInfo() {
			if(isset($_POST[$this->m_getRegisterBoatButton]) != null) {
				return true;
			}
			return false;
		}
		
		public function TriedToDeleteBoat(){
			if (isset($_POST[$this->m_getDeleteBoatButton]) != null) {
				return TRUE;
			}
			return FALSE;
		}
		
		public function TriedToEditBoat(){
			if (isset($_POST[$this->m_getBoatUpdateButton]) != null) {
				return TRUE;
			}
			return FALSE;
		}


	
}
?>